package br.com.iswe.recipemaster.entities.security;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

import br.com.iswe.core.entidades.annotation.GeradorConfig;
import br.com.iswe.core.entidades.annotation.SecurityStrategyType;
import br.com.iswe.recipemaster.entities.BaseEntity;

import com.google.appengine.api.datastore.Key;

/**
 * 
 * @author Rafael Noronha
 * 
 * Entidade que define um papel do usuario no sistema.
 */
@Entity
@GeradorConfig(securityStrategy = SecurityStrategyType.ACEGI_ISWE_INTEGRATION)
public class Role extends BaseEntity {
	private static final long serialVersionUID = 652323987283731361L;//Digite um serial Valido

	public static final String ROLE 	= "ROLE";
	public static final String ADMIN 	= "ADMIN";
	public static final String WRITE 	= "WRITE";
	public static final String READ 	= "READ";
	public static final String REMOVE 	= "REMOVE";
	
	public static final String UC 			= "UC";
	public static final String UC_ADMIN 	= "A";
	public static final String INSERIR 		= "I";
	public static final String ALTERAR 		= "U";
	public static final String CONSULTAR 	= "R";
	public static final String DELETAR 		= "D";
	
	private Key roleId;
	
	private String roleName;
	private String description;
	
	private Key roleTypeKey;
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Key getRoleId() {
		return roleId;
	}
	public void setRoleId(Key roleId) {
		this.roleId = roleId;
	}
	
	@Basic
	@GeradorConfig( label = "Role Type")
	public Key getRoleTypeKey() {
		return roleTypeKey;
	}
	public void setRoleTypeKey(Key roleType) {
		this.roleTypeKey = roleType;
	}
	
	@Column(nullable = false, length = 100)
	@GeradorConfig(campoDescricao=true)
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
	@Column(nullable = false)
	@GeradorConfig(label = "Role")
	public String getRoleName() {
		return roleName;
	}
	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}
}